import request from '@/util/request'

export const cacheAdd = (data: any) => {
  return request({
    url: '/cache',
    method: 'POST',
    data: data
  })
}
export const cacheRemove = (id: number) => {
  return request({
    url: '/cache',
    method: 'DELETE',
    params: {
      id: id
    }
  })
}
export const cacheModify = (data: any) => {
  return request({
    url: '/cache',
    method: 'PUT',
    data: data
  })
}
export const cacheFind = (data: any, pageInfo: any) => {
  return request({
    url: '/cache/list',
    method: 'GET',
    params: {
      ...data, ...pageInfo
    }
  })
}
export const cacheFindById = (id: number) => {
  return request({
    url: '/cache',
    method: 'GET',
    params: {
      id: id
    }
  })
}
//删除缓存值
export const cacheValueDelete = (id: number) => {
  return request({
    url: '/cache/value',
    method: 'DELETE',
    params: {
      id: id
    }
  })
}

//添加缓存值
export const cacheValueAdd = (data: any) => {
  return request({
    url: '/cache/value',
    method: 'POST',
    data: data
  })
}

export const getGlobalCache = () => {
  return request({
    url: '/cache/globalCache',
    method: 'GET'
  })
}
export const refreshGlobalCacheValue = () => {
  return request({
    url: '/cache/refresh',
    method: 'GET'
  })
}
